package 创建者模式.单例模式.懒汉式.demo;

public class Singleton {
    //1.私有构造方法
    private Singleton(){}
    //2.声明Singleton类型的变量instance
    private static Singleton instance;
    //3.对外提供访问方式
    public static Singleton getInstance(){
        if (instance==null){
            instance=new Singleton();
        }
        return instance;
    }
}
